﻿using System;

namespace Entities
{
    [Serializable]
    public class tblProductToCategory
    {
        private int product_id;
        private int category_id;

        public tblProductToCategory() {}

        public tblProductToCategory(int product_id, int category_id)
        {
            this.product_id = product_id;
            this.category_id = category_id;
        }

        public int productID
        {
            get { return this.product_id; }
            set
            {
                if (value == null)
                    throw new Exception("Mă sản phẩm không được để trống!");
                this.product_id = value;
            }
        }

        public int categoryID
        {
            get { return this.category_id; }
            set
            {
                this.category_id = value;
            }
        }

        public override string ToString()
        {
	        return this.product_id+"; "+this.category_id+"; ";
	    }
	    public override bool Equals(Object obj)
	    {
            tblProductToCategory me = (tblProductToCategory)obj;
            bool ret = this.productID.Equals(me.productID);
	        return ret;
	    }
	    public override int GetHashCode()
	    {
            return this.productID.GetHashCode();
	    }

    }
}
